package com.cloud.wms.ui.sort.detach;

import android.os.Message;

import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.cloud.wms.R;
import com.cloud.wms.base.BaseBarListActivity;
import com.cloud.wms.config.IntentKey;
import com.cloud.wms.ui.sort.contract.DetachContact;
import com.cloud.wms.ui.sort.entity.DetachDetailBean;
import com.cloud.wms.ui.sort.presenter.DetachPresenter;

import java.util.List;

/**
 * Created by FC on 2021/3/10.
 * Desc：二次分拨明细
 */
public class DetachDetailActivity extends BaseBarListActivity<DetachDetailBean, DetachPresenter> implements DetachContact.View {

    @Override
    protected String barTitle() {
        return "分拨明细";
    }

    @Override
    protected int getResId() {
        return R.layout.activity_second_allocation_detail;
    }

    @Override
    protected int getItemResId() {
        return R.layout.item_second_allocation_detail;
    }

    @Override
    protected void initEvent() {
        super.initEvent();
        List<DetachDetailBean> detailBeanList = (List<DetachDetailBean>) getIntent().getSerializableExtra(IntentKey.OBJECT_KEY);
        mAdapter.setNewInstance(detailBeanList);
    }

    @Override
    protected void bindItemData(BaseViewHolder helper, DetachDetailBean item) {
        helper.setText(R.id.tv_commodity_name, item.getCommodityName())
                .setText(R.id.tv_bar_code, item.getBarCode())
                .setText(R.id.tv_grid_number, String.valueOf(item.getBatchNo()))
                .setText(R.id.tv_sort_amount, item.getSortAmount() + " / " + (item.getAmount() - item.getSortAmount()));
    }


    @Override
    protected void setupComponent() {

    }

    @Override
    public void onSuccess(Message message) {

    }
}
